Skip to content

fix(eth): allow eth_call and eth_estimateGas from contract and non-existent senders - #7435

Draft
sudo-shashank wants to merge 17 commits into
mainfrom
shashank/port-eth-changes
Draft

fix(eth): allow eth_call and eth_estimateGas from contract and non-existent senders#7435
sudo-shashank wants to merge 17 commits into
mainfrom
shashank/port-eth-changes

Conversation

@sudo-shashank

@sudo-shashank sudo-shashank commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes #7394

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • This pull request is based on an issue that a maintainer has accepted (see Before Opening a Pull Request).
  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • Bug Fixes
    • Improved eth_call and eth_estimateGas compatibility with contract senders and nonexistent accounts.
    • Preserved execution-revert errors and improved gas estimation reliability with appropriate limits.
    • Added clearer handling for invalid or missing sender accounts.
  • Tests
    • Expanded API parity coverage across versions, including omitted senders, insufficient funds, contract creation, failing initialization, and future block scenarios.
  • Documentation
    • Documented the updated Ethereum API behavior in the unreleased changelog.

@sudo-shashank sudo-shashank added the RPC requires calibnet RPC checks to run on CI label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)

Walkthrough

Gas estimation and call simulation now support enforced or skipped sender validation. Ethereum RPC paths handle contract and nonexistent senders. State-manager simulation creates ephemeral senders when validation is skipped. Parity tests cover the new behavior.

Changes

Sender validation flow

Layer / File(s) Summary
Validation policy and message simulation
src/state_manager/errors.rs, src/state_manager/message_simulation.rs
Adds sender-validation modes and errors. Simulation enforces sender existence or creates ephemeral senders when validation is skipped.
Gas estimation policy propagation
src/rpc/methods/gas.rs
Gas estimation accepts a validation mode, forwards it to execution, and reports sender-validation failures.
Ethereum sender fallback and gas search
src/rpc/methods/eth.rs
eth_estimate_gas falls back to skipped validation for contract or nonexistent senders. Gas search and trace-call execution preserve explicit validation policies.
Parity coverage and release configuration
src/tool/subcommands/api_cmd/api_compare_tests.rs, src/tool/subcommands/api_cmd/test_snapshots.txt, scripts/tests/*/.env, scripts/devnet/.env, CHANGELOG.md
Adds parity cases and snapshots. Updates Lotus images and documents the change.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant eth_estimate_gas
  participant GasEstimateGasLimit
  participant StateManager
  participant call_with_gas
  eth_estimate_gas->>GasEstimateGasLimit: select SenderValidation
  GasEstimateGasLimit->>StateManager: estimate gas
  StateManager->>call_with_gas: simulate message
  call_with_gas-->>GasEstimateGasLimit: receipt or SenderValidationFailed
  GasEstimateGasLimit-->>eth_estimate_gas: estimate or skipped-validation retry
Loading

Possibly related PRs

  • ChainSafe/forest#7456: Both changes modify gas-estimation execution-status handling in src/rpc/methods/eth.rs.

Suggested reviewers: eclesiomelojunior, hanabi1224

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The implementation and tests address sender bypass, but no evidence confirms the required performance benchmark against Lotus. Provide benchmark results against Lotus and confirm Forest is at least as performant out of the box.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: allowing eth_call and eth_estimateGas from contract and nonexistent senders.
Out of Scope Changes check ✅ Passed The code, tests, snapshots, changelog, and Lotus image updates support the linked issue objectives and show no unrelated changes.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch shashank/port-eth-changes
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch shashank/port-eth-changes

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/rpc/methods/eth.rs (1)

2109-2124: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

A zero msg.gas_limit makes the growth loop run forever.

If msg.gas_limit is 0 on entry, then high = 0 and low = 0. The condition high < BLOCK_GAS_LIMIT holds. can_succeed at limit 0 fails. Line 2123 then computes 0.saturating_mul(2).min(BLOCK_GAS_LIMIT), which is 0. high never grows and the loop never exits. Each iteration performs a full VM execution through call_with_gas, so the request thread hangs and consumes CPU without bound.

The new Skip path makes this reachable. eth_estimate_gas_skip_sender derives gas_limit from GasEstimateGasLimit::estimate_gas_limit, which returns -1 when the receipt is absent (src/rpc/methods/gas.rs Line 286). At Lines 1966-1967 the value becomes ((-1i64 as f64) * overestimation) as u64. A negative f64 to u64 cast saturates to 0 in Rust, so msg.set_gas_limit(0) runs and 0 reaches gas_search.

Fix the loop so it always makes progress. Also reject the -1 sentinel in eth_estimate_gas_skip_sender before you scale it.

🐛 Proposed fix
     let mut high = msg.gas_limit;
     let mut low = msg.gas_limit;
 
+    // A zero limit would make the doubling below stall at zero.
+    if high == 0 {
+        high = 1;
+    }
+

Apply this at Lines 1966-1968 so the sentinel never becomes a gas limit:

+    anyhow::ensure!(
+        gas_limit >= 0,
+        "gas estimation returned no receipt for a skipped-validation sender"
+    );
     let gas_limit =
         ((gas_limit as f64 * ctx.mpool.gas_limit_overestimation()) as u64).min(BLOCK_GAS_LIMIT);
     msg.set_gas_limit(gas_limit);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/rpc/methods/eth.rs` around lines 2109 - 2124, Prevent zero gas limits
from stalling gas search and reject the missing-receipt sentinel. In gas_search,
ensure the growth loop always advances when high is zero while preserving the
BLOCK_GAS_LIMIT cap; in eth_estimate_gas_skip_sender, detect the -1 result from
GasEstimateGasLimit::estimate_gas_limit before scaling or calling
msg.set_gas_limit, and return the existing appropriate error path instead.
🧹 Nitpick comments (1)
src/rpc/methods/eth.rs (1)

1988-2015: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider accepting the resolved policy as a parameter to avoid a wasted VM execution.

apply_message always attempts SenderValidation::Enforce first, then retries with Skip. Callers that already resolved the policy pay for the discarded first execution.

eth_estimate_gas_skip_sender is one such caller. It resolves the policy through resolve_sender_validation before it runs, then its error arm at Line 1956 calls apply_message, which repeats the Enforce attempt and retries. That is two full VM executions on a request already known to need Skip.

The PR objective includes benchmarking against Lotus. Adding a sender_validation: SenderValidation parameter removes the redundant execution on the known-skip path while keeping the detect-and-retry fallback for callers that pass Enforce.

♻️ Proposed refactor
 async fn apply_message(
     ctx: &Ctx,
     tipset: Option<Tipset>,
     msg: Message,
+    sender_validation: SenderValidation,
 ) -> Result<ApiInvocResult, Error> {
@@
     let result = ctx
         .state_manager
         .apply_on_state_with_gas(
             tipset.clone(),
             msg.clone(),
             VMFlush::Skip,
-            SenderValidation::Enforce,
+            sender_validation,
         )
         .await;
 
-    let needs_skip = match &result {
+    let needs_skip = sender_validation == SenderValidation::Enforce
+        && match &result {
         Err(e) => e
             .downcast_ref::<crate::state_manager::Error>()
             .is_some_and(|e| matches!(e, crate::state_manager::Error::SenderValidationFailed)),
         Ok((invoc_res, _)) => invoc_res
             .msg_rct
             .as_ref()
             .is_some_and(|rct| rct.exit_code() == fvm_shared4::error::ExitCode::SYS_SENDER_INVALID),
     };

Then pass SenderValidation::Skip at Line 1956 and SenderValidation::Enforce at Line 1893.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/rpc/methods/eth.rs` around lines 1988 - 2015, Update apply_message to
accept a SenderValidation parameter and use it for the initial
apply_on_state_with_gas call, while retaining the existing sender-validation
failure detection and retry with Skip when the initial policy is Enforce. Pass
SenderValidation::Skip from the resolved-policy error path in
eth_estimate_gas_skip_sender and SenderValidation::Enforce from the other
apply_message caller.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/rpc/methods/eth.rs`:
- Around line 1927-1934: Update resolve_sender_validation and
estimate_call_with_gas so sender validation uses the same tipset as execution:
either pass the execution tipset from data.mpool.current_tipset() into
resolve_sender_validation, or change execution to use the requested tipset.
Preserve the existing actor-based SenderValidation decisions once both paths
share the same state.

In `@src/tool/subcommands/api_cmd/api_compare_tests.rs`:
- Around line 1651-1669: Update the EthCall and EthEstimateGas cases in the
ApiPaths loop to use strict success assertions instead of
PolicyOnRejected::PassWithIdenticalError, and set msg calldata to a known
non-reverting contract method rather than relying on empty-calldata fallback
behavior. Keep the existing request construction and API-path coverage intact.

---

Outside diff comments:
In `@src/rpc/methods/eth.rs`:
- Around line 2109-2124: Prevent zero gas limits from stalling gas search and
reject the missing-receipt sentinel. In gas_search, ensure the growth loop
always advances when high is zero while preserving the BLOCK_GAS_LIMIT cap; in
eth_estimate_gas_skip_sender, detect the -1 result from
GasEstimateGasLimit::estimate_gas_limit before scaling or calling
msg.set_gas_limit, and return the existing appropriate error path instead.

---

Nitpick comments:
In `@src/rpc/methods/eth.rs`:
- Around line 1988-2015: Update apply_message to accept a SenderValidation
parameter and use it for the initial apply_on_state_with_gas call, while
retaining the existing sender-validation failure detection and retry with Skip
when the initial policy is Enforce. Pass SenderValidation::Skip from the
resolved-policy error path in eth_estimate_gas_skip_sender and
SenderValidation::Enforce from the other apply_message caller.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3ee698fe-9220-4a0c-b643-5281dbb964e6

📥 Commits

Reviewing files that changed from the base of the PR and between 81f6cba and 268ed8d.

📒 Files selected for processing (5)
  • src/rpc/methods/eth.rs
  • src/rpc/methods/gas.rs
  • src/state_manager/errors.rs
  • src/state_manager/message_simulation.rs
  • src/tool/subcommands/api_cmd/api_compare_tests.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • filecoin-project/lotus (manual)

Comment thread src/rpc/methods/eth.rs Outdated
Comment thread src/tool/subcommands/api_cmd/api_compare_tests.rs Outdated
@sudo-shashank sudo-shashank added the Wallet Trigger wallet test on Calibnet label Aug 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/tests/api_compare/.env (1)

3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Pin the Lotus baseline consistently across all test environments.

All three files now use the mutable v1.36.2-calibnet tag. Docker tags can be retargeted, which can change parity and benchmark results without a source change. Use one verified immutable digest across all three files. (docs.docker.com)

  • scripts/tests/api_compare/.env#L3-L3: replace the tag with the pinned digest.
  • scripts/tests/bootstrapper/.env#L2-L2: use the same pinned digest.
  • scripts/tests/snapshot_parity/.env#L1-L1: use the same pinned digest.

Verify that the selected digest is the intended Lotus baseline for PR #13724.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/tests/api_compare/.env` at line 3, Replace the mutable Lotus image
tag with the verified immutable digest for the intended PR `#13724` baseline in
scripts/tests/api_compare/.env:3-3, scripts/tests/bootstrapper/.env:2-2, and
scripts/tests/snapshot_parity/.env:1-1, using exactly the same digest in all
three files.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Around line 44-45: Update the changelog entry’s linked reference from pull
request `#7435` to issue `#7394`, preserving the existing description and
formatting.

---

Nitpick comments:
In `@scripts/tests/api_compare/.env`:
- Line 3: Replace the mutable Lotus image tag with the verified immutable digest
for the intended PR `#13724` baseline in scripts/tests/api_compare/.env:3-3,
scripts/tests/bootstrapper/.env:2-2, and scripts/tests/snapshot_parity/.env:1-1,
using exactly the same digest in all three files.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0b2dff37-88ec-40c4-8e44-351eec8ca545

📥 Commits

Reviewing files that changed from the base of the PR and between 268ed8d and 34090e9.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • scripts/tests/api_compare/.env
  • scripts/tests/bootstrapper/.env
  • scripts/tests/snapshot_parity/.env
  • src/rpc/methods/eth.rs
  • src/tool/subcommands/api_cmd/api_compare_tests.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • filecoin-project/lotus (manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs
  • src/rpc/methods/eth.rs

Comment thread CHANGELOG.md
@sudo-shashank
sudo-shashank marked this pull request as ready for review August 3, 2026 21:30
@sudo-shashank
sudo-shashank requested a review from a team as a code owner August 3, 2026 21:30
@sudo-shashank
sudo-shashank requested review from EclesioMeloJunior and hanabi1224 and removed request for a team August 3, 2026 21:30
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.50000% with 65 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.30%. Comparing base (0b42ef6) to head (a2c4874).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/rpc/methods/eth.rs 62.50% 30 Missing and 6 partials ⚠️
src/state_manager/message_simulation.rs 64.91% 14 Missing and 6 partials ⚠️
src/rpc/methods/gas.rs 80.85% 7 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/state_manager/errors.rs 40.00% <ø> (ø)
src/state_manager/mod.rs 69.37% <ø> (+5.03%) ⬆️
src/rpc/methods/gas.rs 87.88% <80.85%> (+1.12%) ⬆️
src/state_manager/message_simulation.rs 76.80% <64.91%> (-1.71%) ⬇️
src/rpc/methods/eth.rs 69.38% <62.50%> (+0.81%) ⬆️

... and 12 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6ebc6a...a2c4874. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sudo-shashank
sudo-shashank marked this pull request as draft August 4, 2026 06:50
@sudo-shashank
sudo-shashank marked this pull request as ready for review August 4, 2026 08:02
@sudo-shashank
sudo-shashank marked this pull request as draft August 5, 2026 09:29

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
scripts/devnet/.env (1)

10-10: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Restore dotenv key order.

Move FOREST_P2P_PORT before FOREST_RPC_PORT. dotenv-linter reports UnorderedKey at Line 10.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/devnet/.env` at line 10, Reorder the environment keys in the dotenv
configuration so FOREST_P2P_PORT appears before FOREST_RPC_PORT, preserving
their existing values.

Source: Linters/SAST tools

src/tool/subcommands/api_cmd/api_compare_tests.rs (1)

1651-1782: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add context to fallible test setup.

Import anyhow::Context and add .context(...) to the fallible address, calldata, initcode, and request-construction operations in these helpers. Include the affected test case or API method in each message.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tool/subcommands/api_cmd/api_compare_tests.rs` around lines 1651 - 1782,
Add anyhow::Context and annotate fallible setup operations in
eth_skip_sender_success_tests, eth_skip_sender_insufficient_funds_tests,
eth_skip_sender_create_reject_tests, and eth_skip_sender_block_param_tests with
contextual errors identifying the relevant test case or API method. Apply
context to address, calldata/initcode parsing, and EthCall/EthEstimateGas
request construction, including failures propagated through
eth_skip_sender_cases.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/devnet/.env`:
- Line 10: Reorder the environment keys in the dotenv configuration so
FOREST_P2P_PORT appears before FOREST_RPC_PORT, preserving their existing
values.

In `@src/tool/subcommands/api_cmd/api_compare_tests.rs`:
- Around line 1651-1782: Add anyhow::Context and annotate fallible setup
operations in eth_skip_sender_success_tests,
eth_skip_sender_insufficient_funds_tests, eth_skip_sender_create_reject_tests,
and eth_skip_sender_block_param_tests with contextual errors identifying the
relevant test case or API method. Apply context to address, calldata/initcode
parsing, and EthCall/EthEstimateGas request construction, including failures
propagated through eth_skip_sender_cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e5ed9cfb-df83-4111-8be2-8c41afd0b8df

📥 Commits

Reviewing files that changed from the base of the PR and between f606af7 and fa5325c.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • scripts/devnet/.env
  • src/rpc/methods/eth.rs
  • src/rpc/methods/gas.rs
  • src/state_manager/message_simulation.rs
  • src/tool/subcommands/api_cmd/api_compare_tests.rs
  • src/tool/subcommands/api_cmd/test_snapshots.txt
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • filecoin-project/lotus (manual)
🚧 Files skipped from review as they are similar to previous changes (4)
  • CHANGELOG.md
  • src/rpc/methods/eth.rs
  • src/state_manager/message_simulation.rs
  • src/rpc/methods/gas.rs

@sudo-shashank
sudo-shashank marked this pull request as ready for review August 7, 2026 03:48
Comment thread src/tool/subcommands/api_cmd/test_snapshots.txt
Comment thread src/tool/subcommands/api_cmd/api_compare_tests.rs Outdated
Comment thread src/tool/subcommands/api_cmd/api_compare_tests.rs Outdated
Comment thread src/tool/subcommands/api_cmd/api_compare_tests.rs Outdated
@LesnyRumcajs

Copy link
Copy Markdown
Member

@sudo-shashank Did you run your changes against local CC review? I ran it on this PR and it surfaced some potential issues.

Correctness:
1. eth.rs:2064 — out-of-gas trace check is dead. Some(_expected_exit_code) is a fresh pattern binding, so it matches any exit code, not SYS_OUT_OF_GAS. A genuinely-reverting eth_estimateGas can be pushed into gas_search and return a bogus near-block-limit estimate instead of the revert error. This is the most important one — and it directly qualifies the parity agent's "point 5 correct" verdict.
2. message_simulation.rs:195 — skip-retry never fires for ID-mapped senders. The Enforce branch propagates an untyped resolve error, so eth_call from a non-existent 0xff..<id> sender errors out where Lotus (which checks GetActor first) succeeds. The sibling gas.rs path types it correctly, so the two are inconsistent.
3. gas.rs:281 — lost diagnostics. Direct Filecoin.GasEstimate* callers now get a bare "sender validation failed" instead of the exit-code + reason main surfaced.

Plausible:
4. gas.rs:225 — map_err(|_| …) swallows the real error. A transient blockstore/state read failure gets misclassified as a sender-validation problem and silently falls into the skip-sender path with a fabricated placeholder.

Cleanups: a redundant tipset+actor load on the hot EOA path (eth.rs:1875), a duplicated overestimation/cap formula that can drift (eth.rs:1974), and unconditional tipset+msg clones for a rarely-fired retry (eth.rs:1997).

Are those plausible?

@sudo-shashank

sudo-shashank commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@sudo-shashank Did you run your changes against local CC review? I ran it on this PR and it surfaced some potential issues.

Correctness:
1. eth.rs:2064 — out-of-gas trace check is dead. Some(_expected_exit_code) is a fresh pattern binding, so it matches any exit code, not SYS_OUT_OF_GAS. A genuinely-reverting eth_estimateGas can be pushed into gas_search and return a bogus near-block-limit estimate instead of the revert error. This is the most important one — and it directly qualifies the parity agent's "point 5 correct" verdict.
2. message_simulation.rs:195 — skip-retry never fires for ID-mapped senders. The Enforce branch propagates an untyped resolve error, so eth_call from a non-existent 0xff..<id> sender errors out where Lotus (which checks GetActor first) succeeds. The sibling gas.rs path types it correctly, so the two are inconsistent.
3. gas.rs:281 — lost diagnostics. Direct Filecoin.GasEstimate* callers now get a bare "sender validation failed" instead of the exit-code + reason main surfaced.

Plausible:
4. gas.rs:225 — map_err(|_| …) swallows the real error. A transient blockstore/state read failure gets misclassified as a sender-validation problem and silently falls into the skip-sender path with a fabricated placeholder.

Cleanups: a redundant tipset+actor load on the hot EOA path (eth.rs:1875), a duplicated overestimation/cap formula that can drift (eth.rs:1974), and unconditional tipset+msg clones for a rarely-fired retry (eth.rs:1997).

Are those plausible?

Yes

@sudo-shashank
sudo-shashank requested review from LesnyRumcajs and removed request for hanabi1224 August 11, 2026 03:59
@LesnyRumcajs

Copy link
Copy Markdown
Member

Yes

Yes what? Which issues were correctly flagged and fixed, and which did you discard?

@sudo-shashank

sudo-shashank commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Yes

Yes what? Which issues were correctly flagged and fixed, and which did you discard?

  1. eth.rs:2064 — out-of-gas trace check is dead is also valid but not covered here as related changes are drafted in fix(rpc): raise eth_estimateGas until the message succeeds + tests #7473. Reviewing the changes there.

  2. message_simulation.rs was valid and fixed, Enforce maps to Error::SenderValidationFailed so the skip-retry fires for ID-mapped senders.

  3. gas.rs:281 — lost diagnostics was also valid and fixed

  4. gas.rs:225 — map_err(|_| …) swallows the real error, this is also valid but for now we are only preserving the error msg. Still looking into transient read failure getting misclassified.

  5. Cleanups of redundant load and the duplicated formula are both fixed.

@sudo-shashank
sudo-shashank marked this pull request as draft August 11, 2026 09:52
@LesnyRumcajs

Copy link
Copy Markdown
Member

Still looking into transient read failure getting misclassified.

Ok, in this case if you're still looking into it, please put the PR to draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI Wallet Trigger wallet test on Calibnet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow eth_call and eth_estimateGas from contract and non-existent senders

3 participants